﻿Public Class frmThanhToan

    Private Sub frmThanhToan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim mahoadon As Integer = Me.Tag
        Label1.Text = mahoadon

        lvlDanhSachMua.Columns.Add("", 0)
        lvlDanhSachMua.Columns.Add("Tên sản phẩm", 100)
        lvlDanhSachMua.Columns.Add("Số lượng", 70)
        lvlDanhSachMua.Columns.Add("Giá tiền", 100)

        Dim th As TapHoa = New TapHoa()
        Dim TenSanPham As String
        th.m_intMaHoaDon = mahoadon
        Dim dt As DataTable = TapHoaDAO.LayThongTinSanPhamDaMua(th)
        Dim lv As DataRow
        For Each lv In dt.Rows
            Dim item As New ListViewItem()
            th.m_intIDSanPham = lv("ctdh_TenHang").ToString()
            Dim ab As DataTable = TapHoaDAO.LayThongTinMotSanPhamTheoID(th)
            TenSanPham = ab.Rows(0)("hh_TenHang").ToString()
            item.SubItems.Add(TenSanPham)
            item.SubItems.Add(lv("ctdh_SoLuong").ToString())
            item.SubItems.Add(lv("ctdh_Gia").ToString())
            lvlDanhSachMua.Items.Add(item)
        Next
    End Sub

    Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

    End Sub

    Private Sub btnInHoaDon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInHoaDon.Click
        Dim frm As frmHoaDon = New frmHoaDon()
        Dim report As rpHoaDon = New rpHoaDon()
        report.SetParameterValue("MaHoaDon", Label1.Text)
        frm.KhoiTaoReport(report)
        frm.Show()
    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Close()
    End Sub
End Class